/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine - graphics/materials
// Copyright (c) 2015.  All Rights Reserved
//
// File:		AEMaterial.inl
// Author:		Gianluca Belardelli
// Date:		24/07/2015
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEMATERIAL_INL_
#define _AEMATERIAL_INL_

AE_FORCEINLINE const char *AEMaterial::GetName( void ) const
{
	return m_lpName;
}

AE_FORCEINLINE void AEMaterial::SetName( const char *lpNewString )
{
	strcpy( m_lpName, lpNewString );
}
/*
AE_FORCEINLINE const char *AEMaterial::GetEditorUserDataString( void ) const
{
	return m_sUserData.IsEmpty() ? AENULL : m_sUserData.AsChar(); // Explicitly return AENULL here.
}

AE_FORCEINLINE void AEMaterial::SetEditorUserDataString( const char *lpNewString )
{
	m_sUserData = lpNewString;
}
*/
AE_FORCEINLINE AETransparencyType AEMaterial::GetTransparencyType( void ) const
{
	return static_cast<AETransparencyType>( m_uiTransparencyType );
}

AE_FORCEINLINE void AEMaterial::SetTransparencyType( AETransparencyType ttType )
{
	m_uiTransparencyType = static_cast<AEUINT8>( ttType );
	ResolvePassType();
}

AE_FORCEINLINE AEBOOL32 AEMaterial::IsTranslucent( void ) const
{
	return ( m_uiTransparencyType != AETRANSPTYPE_NONE ) && ( m_uiTransparencyType != AETRANSPTYPE_ALPHATEST );
}

AE_FORCEINLINE AEBOOL32 AEMaterial::IsDoubleSided( void ) const
{
	return m_bDoubleSided;
}

AE_FORCEINLINE void AEMaterial::SetDoubleSided( AEBOOL32 bDoubleSided )
{
	m_bDoubleSided = bDoubleSided;
}

AE_FORCEINLINE AEBOOL32 AEMaterial::IsDepthWriteEnabled( void ) const
{
	return m_bDepthWrite;
}

AE_FORCEINLINE AEUINT8 AEMaterial::GetTextureClampingMask( void ) const
{
	return m_uiClampUV;
}

AE_FORCEINLINE AEPassType AEMaterial::GetPassType( void ) const
{
	return (AEPassType)m_uiPassType;
}

AE_FORCEINLINE void AEMaterial::SetPassType( AEPassType eType )
{
	m_uiPassType = eType;
}

AE_FORCEINLINE AEPassType AEMaterial::GetResolvedPassType( void ) const
{
	return (AEPassType)m_uiResolvedPassType;
}

AE_FORCEINLINE void AEMaterial::SetDepthWriteEnabled( AEBOOL32 bEnable )
{
	m_bDepthWrite = bEnable;
}

AE_FORCEINLINE void AEMaterial::SetUseTextureClamping( AEBOOL32 bClampU, AEBOOL32 bClampV )
{
	m_uiClampUV = (bClampU ? AESETBIT(0) : 0) | (bClampV ? AESETBIT(1) : 0);
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetDepthBias( void ) const
{
	return m_fDepthBias;
}

AE_FORCEINLINE void AEMaterial::SetDepthBias( AEFLOAT32 fBias )
{
	m_fDepthBias = fBias;
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetDepthBiasClamp( void ) const
{
	return m_fDepthBiasClamp;
}

AE_FORCEINLINE void AEMaterial::SetDepthBiasClamp( AEFLOAT32 fBiasClamp )
{
	m_fDepthBiasClamp = fBiasClamp;
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetSlopeScaledDepthBias( void ) const
{
	return m_fSlopeScaledDepthBias;
}

AE_FORCEINLINE void AEMaterial::SetSlopeScaledDepthBias( AEFLOAT32 fScaledBias )
{
	m_fSlopeScaledDepthBias = fScaledBias;
}

AE_FORCEINLINE AEMaterial::AEGeometryTopology AEMaterial::GetGeometryTopology( void ) const
{
	return static_cast<AEGeometryTopology>(m_uiGeometryTopology);
}

AE_FORCEINLINE void AEMaterial::SetGeometryTopology( AEMaterial::AEGeometryTopology eType )
{
	m_uiGeometryTopology = eType;
}

AE_FORCEINLINE AEBOOL32 AEMaterial::IsFullbright( void ) const
{
	return m_uiLightingMethod == AELIGHTING_FULLBRIGHT;
}

AE_FORCEINLINE AEColor AEMaterial::GetAmbientColor( void ) const
{
	return m_crAmbientColor;
}

AE_FORCEINLINE void AEMaterial::SetAmbientColor( const AEColor &refColor )
{
	m_crAmbientColor = refColor;
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetSpecularMultiplier( void ) const
{
	return m_fSpecMul;
}

AE_FORCEINLINE void AEMaterial::SetSpecularMultiplier( AEFLOAT32 fMultiplier )
{
	m_fSpecMul = fMultiplier;
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetSpecularExponent( void ) const
{
	return m_fSpecExp;
}

AE_FORCEINLINE void AEMaterial::SetSpecularExponent( AEFLOAT32 fExponent )
{
	m_fSpecExp = fExponent;
}

AE_FORCEINLINE void AEMaterial::SetAlphaTestThreshold( AEFLOAT32 fAlphaThreshold )
{
	m_fCustomAlphaThreshold = fAlphaThreshold;
}

AE_FORCEINLINE void AEMaterial::SetMesh( AEBaseMesh *lpMesh )
{
	m_lpOwnerMesh = lpMesh;
}

AE_FORCEINLINE AEBaseMesh *AEMaterial::GetMesh( void ) const
{
	return m_lpOwnerMesh;
}

AE_FORCEINLINE void AEMaterial::SetSortingKey( AEUINT8 uiKey )
{
	m_uiSortingKey = uiKey;
}

AE_FORCEINLINE AEUINT8 AEMaterial::GetSortingKey( void ) const
{
	return m_uiSortingKey;
}

AE_FORCEINLINE AEBOOL32 AEMaterial::GetCastStaticShadows( void ) const
{
	return m_bCastStaticShadows;
}

AE_FORCEINLINE void AEMaterial::SetCastStaticShadows( AEBOOL32 bEnable )
{
	m_bCastStaticShadows = bEnable;
}

AE_FORCEINLINE void AEMaterial::SetMaterialFlags( AEINT32 nFlags)
{
	m_nMaterialFlags = nFlags;
	ResolvePassType();
}

AE_FORCEINLINE AEBOOL32 AEMaterial::IsMaterialFlagSet( AEINT32 nFlag ) const
{
	return ((m_nMaterialFlags & nFlag) != 0);
}

AE_FORCEINLINE void AEMaterial::RaiseMaterialFlag( AEINT32 nFlag )
{
	m_nMaterialFlags |= nFlag;
	ResolvePassType();
}

AE_FORCEINLINE void AEMaterial::ClearMaterialFlag( AEINT32 nFlag )
{
	m_nMaterialFlags &= ~nFlag;
	ResolvePassType();
}

AE_FORCEINLINE void AEMaterial::SetUserFlags( AEINT32 nFlags )
{
	m_nUserFlags = nFlags;
}

AE_FORCEINLINE AEINT32 AEMaterial::GetUserFlags( void ) const
{
	return (m_nUserFlags);
}

AE_FORCEINLINE AEBOOL32 AEMaterial::IsUserFlagSet( AEINT32 nFlag ) const
{
	return ((m_nUserFlags & nFlag) != 0);
}

AE_FORCEINLINE void AEMaterial::RaiseUserFlag( AEINT32 nFlag )
{
	m_nUserFlags |= nFlag;
}

AE_FORCEINLINE void AEMaterial::ClearUserFlag( AEINT32 nFlag )
{
	m_nUserFlags &= ~nFlag;
}

AE_FORCEINLINE AEUINT8 AEMaterial::GetDeferredID( void ) const
{
	return m_uiDeferredID;
}

AE_FORCEINLINE void AEMaterial::SetDeferredID( AEUINT8 uiId )
{
	m_uiDeferredID = uiId;
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetParallaxScale( void ) const
{
	return m_fParallaxScale;
}

AE_FORCEINLINE void AEMaterial::SetParallaxScale( AEFLOAT32 fScale )
{
	m_fParallaxScale = fScale;
}

AE_FORCEINLINE AEFLOAT32 AEMaterial::GetParallaxBias( void ) const
{
	return m_fParallaxBias;
}

AE_FORCEINLINE void AEMaterial::SetParallaxBias( AEFLOAT32 fBias )
{
	m_fParallaxBias = fBias;
}

AE_FORCEINLINE void AEMaterial::SetShaderMode( AEMaterial::AEShaderMode eShaderMode )
{
	m_eShaderMode = eShaderMode;
}

AE_FORCEINLINE AEMaterial::AEShaderMode AEMaterial::GetShaderMode( void ) const
{
	return m_eShaderMode;
}

AE_FORCEINLINE AELightingMethod AEMaterial::GetLightingMode( void ) const
{
	return static_cast<AELightingMethod>( m_uiLightingMethod );
}

AE_FORCEINLINE void AEMaterial::SetLightingMode( AELightingMethod lmMode )
{
	m_uiLightingMethod = static_cast<AEUINT8>( lmMode );
}

AE_FORCEINLINE AEINT32 AEMaterial::GetOtherSurfaceReferenceCounter( void ) const
{
	return m_nReferencedByOthers;
}

AE_FORCEINLINE void AEMaterial::addReferenceByOtherSurface( void )
{
	++m_nReferencedByOthers;
}

AE_FORCEINLINE void AEMaterial::removeReferenceByOtherSurface( void )
{
	--m_nReferencedByOthers;
}

#endif // _AEMATERIAL_INL_

